package code.tools.commponents
{
	import code.structure.manager.loader.DllLoaderManager;
	import code.structure.manager.font.FontManager;
	import code.untils.UiNameConst;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;

	/**
	 *带页码的翻页 
	 * @author liangqian
	 * 
	 */	
	public class PageTurningWithPage extends PageTurning
	{
		private var pageNumTf:TextField;
		
		public function PageTurningWithPage(parent:DisplayObjectContainer=null, xpos:Number=0, ypos:Number=0,pageHandler:Function = null)
		{
			super(parent, xpos, ypos,44,pageHandler);
		}
		
		override protected function init():void
		{
			setSize(80,26);
			super.init();
		}
		
		override protected function addChildren():void
		{
			var view:Sprite = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'pageTurningWithPage')as Class)as MovieClip;
			addChild(view);
			view.x = 24;
			pageNumTf = view.getChildByName('pageNumber_text')as TextField;
			pageNumTf = Helpers.replaceTf(pageNumTf,FontManager.getInstance().embeddedFontAName);
			view.mouseChildren = false;
			
			super.addChildren();
			
			scaleXY(.5);
		}
		
		override protected function update():void
		{
			super.update();
			pageNumTf.text = index + '/' + (max + 1);
		}
	}
}